﻿using AutoMapper;
using FurnitureDesign.Core.Models;
using FurnitureDesign.Mvc.Models.Products;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FurnitureDesign.Mvc.Models
{
    public class ServiceProfile:Profile
    {
        public ServiceProfile()
        {
            CreateMap<Product, ProductViewModel>().ForMember(
                dest => dest.ProductTypeName,
                opt => opt.MapFrom(src => src.ProductType.ProductTypeName));
            CreateMap<ProductViewModel, Product>();

            CreateMap<ProductType, ProductViewModel>();
            CreateMap<ProductViewModel, ProductType>();

            CreateMap<RealInfo, RealInfoViewModel>().ForMember(
                dest => dest.RealInfoTypeName,
                opt => opt.MapFrom(src => src.RealInfoType.RealInfoTypeName));
            CreateMap<RealInfoViewModel, RealInfo>();

            CreateMap<RealInfoType, RealInfoViewModel>();
            CreateMap<RealInfoViewModel, RealInfoType>();
        }
    }
}
